<template>
  <div>
    <el-tree
      :data="data"
      :props="defaultProps"
      @node-click="nodeClick"
    >
    </el-tree>

  </div>
</template>

<script>
export default {
  data() {
    return {
      msg: "分类维护页面",
      data: [],
      defaultProps: {
        children: "children",
        label: "name",
      },
    };
  },
  methods: {
    nodeClick(node){
      console.log(node);
      this.$emit("tree-node-click",node);
    },
    // 获取数据列表
    getTreeList() {
      this.$http({
        url: this.$http.adornUrl("/product/category/tlist"),
        method: "get",
        params: this.$http.adornParams(),
      }).then(({ data }) => {
        console.log(data);
        this.data = data.page;
      });
    },
    
  },
  created() {
    this.getTreeList();
  },
};
</script>

